

// commpents/navbar/navbar.js
const app = getApp()
Component({
  /* 组件的属性列表 */
  properties: {
    thiscur:{
      type: Number,
    }
  },
  /**
   * 组件的初始数据
   */
  data:{
    listInfo: [{
      text: '首页',
      imgUrl: '../../pages/images/home.png',
      curUrl: '../../pages/images/homeact.png',
    },
    {
      text: '预约',
      imgUrl: '../../pages/images/time.png',
      curUrl: '../../pages/images/homeact.png',
    },
    {
      text: '商店',
      imgUrl: '../../pages/images/store.png',
      curUrl: '../../pages/images/homeact.png',
    },
    {
      text: '活动',
      imgUrl: '../../pages/images/activity.png',
      curUrl: '../../pages/images/homeact.png',
    },
    {
      text: '我的',
      imgUrl: '../../pages/images/my.png',
      curUrl: '../../pages/images/homeact.png',
    }]
  },
  lifetimes: {
    // 生命周期函数
    attached: function () {
      this.setData({
        curIdx: this.properties.thiscur
      })
     },
    moved: function () { },
    detached: function () { },
  },
  methods:{
    // 底部导航
    chooseImg: function (e) {
      var that = this
      console.log("footIndex", e.currentTarget.dataset.current)
      if (e.currentTarget.dataset.current == 0) { // "首页"模块
        wx.switchTab({
          url: '/pages/indexs/index/index',
        })
      } else if (e.currentTarget.dataset.current == 1) { // "预约"模块
        wx.navigateTo({
          url: '/pages/indexs/storeInformation/storeInformation',
        });
      } else if (e.currentTarget.dataset.current == 2) { // "商品"模块
        wx.switchTab({
          url: '/pages/stores/store/store',
        })
      } else if (e.currentTarget.dataset.current == 3) {  // "活动"模块
        wx.switchTab({
          url: '/pages/activitys/activity/activity',
        })
      } else if (e.currentTarget.dataset.current == 4) { // "我的"模块
        wx.switchTab({
          url: '/pages/mines/mine/mine',
        })
      }
    },
  },
})
